package com.dave.gd.core.common.globalsession;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

public class GlobalSessionHttpRequest extends HttpServletRequestWrapper {
    
    private final String            sessionId;
    private final String            namespace;
    private final GlobalHttpSession session;
    
    public GlobalSessionHttpRequest(ServletRequest request, String sessionId, String namespace,
        Integer timeoutMinutes) {
        super((HttpServletRequest) request);
        this.sessionId = sessionId;
        this.namespace = namespace;
        session = new GlobalHttpSession(sessionId, namespace, timeoutMinutes, super.getSession());
    }
    
    @Override
    public GlobalHttpSession getSession() {
        return session;
    }
    
    @Override
    public GlobalHttpSession getSession(boolean create) {
        return session;
    }
    
    public String getSessionId() {
        return sessionId;
    }
    
    public String getNamespace() {
        return namespace;
    }
    
}
